package com.fyzk.random;

import java.util.ArrayList;
import java.util.List;

import com.fyzk.activity.lottery.shuzicai.BallInfo;
import com.fyzk.betcode.BetLotteryInfo;

public abstract class RandomBase {

	public abstract int[] randomDanHang(int count);
	public int[] randomDanHang(int count, int maxNum){
		return new int[0];
	}
	public int[] randomDuoHang(int count, int start, int end){
		return null;
	};
	
	public	abstract void randomYiZhu(BetLotteryInfo infor);
	
	public int[] randomLan(int count){
		return new int[]{0} ;
	}
	
	public List<List<BallInfo>> initList(List<List<BallInfo>> arr_infos){
		List<List<BallInfo>> arr = new ArrayList<List<BallInfo>>();
		for (int i = 0; i < arr_infos.size(); i++) {
			List<BallInfo> ballInfos = arr_infos.get(i);
			List<BallInfo> ballInfos2 = new ArrayList<BallInfo>();
//			if (ballInfos.get(0).getNum().equals("00")) {
//				initBallList(ballInfos2, ballInfos.size(), 0);
//			}else{
//				initBallList(ballInfos2, ballInfos.size(), 1);
//			}
			for (int j = 0; j < ballInfos.size(); j++) {
				ballInfos2.add(new BallInfo(ballInfos.get(j).getNum()));
			}
			arr.add(ballInfos2);
		}
		return arr;
	}
	public List<List<BallInfo>> initList2(List<List<BallInfo>> arr_infos){
		List<List<BallInfo>> arr_balls = new ArrayList<List<BallInfo>>();
		for (int i = 0; i < arr_infos.size(); i++) {
			List<BallInfo> arr = arr_infos.get(i);
			List<BallInfo> arr_ball = new ArrayList<BallInfo>();
			for (int j = 0; j < arr.size(); j++) {
				BallInfo ballInfo = new BallInfo(arr.get(j).getNum());
				ballInfo.prize = arr.get(j).prize;
				ballInfo.rect_top = arr.get(j).rect_top;
				ballInfo.rect_bottom = arr.get(j).rect_bottom;
				ballInfo.rect_left = arr.get(j).rect_left;
				ballInfo.rect_right = arr.get(j).rect_right;
				ballInfo.type = arr.get(j).type;
				ballInfo.setWei(arr.get(j).getWei());
				ballInfo.setSelected(false);
				arr_ball.add(ballInfo);
			}
			arr_balls.add(arr_ball);
		}
		return arr_balls;
	}
	/**
	 * 初始化 小球list
	 * 
	 * @param balls
	 * @param count
	 *            每列显示小球数
	 *            @param start
	 */
	private void initBallList(List<BallInfo> balls, int count,int start) {
		balls.clear();
		for (int j = start; j < count+start; j++) {
			BallInfo qiu;
			if (j < 10) {
				qiu = new BallInfo("0" + j);
			}else{
				qiu = new BallInfo("" + j);
			}
			balls.add(qiu);
		}
	}
	
	/**
	 * 初始化 小球list
	 * @param balls
	 * @param count
	 * @param start
	 * @param hasZero 小球数字是否为"0*"
	 */
	public void initBallList(List<BallInfo> balls, int count,int start,boolean hasZero) {
		balls.clear();
		for (int j = start; j < count+start; j++) {
			BallInfo qiu;
			if(hasZero){
				if (j < 10) {
					qiu = new BallInfo("0" + j);
				}else{
					qiu = new BallInfo("" + j);
				}
			}else{
				qiu = new BallInfo(String.valueOf(j));
			}
			balls.add(qiu);
		}
	}
	
}
